# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=ruby-hamster
_gemname=hamster
pkgver=3.0.0
pkgrel=3
pkgdesc="Efficient, immutable, and thread-safe collection classes for Ruby"
url="https://github.com/hamstergem/hamster"
# x86, armv7, armhf: requires 'java-jffi-native' via 'ruby-concurrent-ruby'
arch="noarch !s390x !x86 !armv7 !armhf"
license="MIT"
depends="ruby ruby-concurrent-ruby"
checkdepends="ruby-rspec"
source="$pkgname-$pkgver.tar.gz::https://github.com/hamstergem/$_gemname/archive/v$pkgver.tar.gz
	specs-remove-extra-deps.patch"
builddir="$srcdir/$_gemname-$pkgver"

build() {
	cd "$builddir"
	gem build $_gemname.gemspec
}

check() {
	cd "$builddir"
	rspec spec
}

package() {
	local gemdir="$pkgdir/$(ruby -e 'puts Gem.default_dir')"

	cd "$builddir"
	gem install --local \
		--install-dir "$gemdir" \
		--ignore-dependencies \
		--no-document \
		--verbose \
		$_gemname

	cd "$gemdir"
	rm -rf cache build_info doc

	cd gems/$_gemname-$pkgver
	rm -rf spec LICENSE
}

sha512sums="ba2f1b843aca907d0e84968160322d0ef7afdc38a45675e7b0cca54fa676d2d0e27503d98ffb605f50f85488b5a228df9bca2b1ba03d4f16148433e7a0dec994  ruby-hamster-3.0.0.tar.gz
ea9c997e69abc3074ba52213610b4ff62179fb8e50243fa6a41cfe85773831c11c793ed04b515ac48aceb45ee29e3d5c3b08dada7eda199f260fe41f566d1bf5  specs-remove-extra-deps.patch"
